<?php
ob_start();
include ('index.php');
		//login de la pagina

		$login='arigo';
		
		if($_SERVER['REQUEST_METHOD']=='POST')
		{
			if(empty ($_POST['password']))
			{
				echo "Debes rellenarlo correctamente.<br>";
				echo "<input type='button' value='Back' onclick='history.go(-1)'/>";
			}
			elseif(preg_match('/^[a-z]$/',$_POST['password']))
			{
				echo "Sintaxis incorrecta";
				echo "<input type='button' value='Back' onclick='history.go(-1)'/>";
			}
			else
			{
				$password = $_POST['password'];

				if($login == $password)
				{
					session_start();
					$_SESSION['user_sesion']= $login;
					header ("Location: index.php");
				}
				else
				{
					echo "Incorrect autentication<br>";
					echo "<input type='button' value='Back' onclick='history.go(-1)'/>";
				}
			}
		}
		else
		{
		echo "<form action='' form method='POST'>";
		echo "Password <input type='password' name='password'><br/>";
		echo "<input type='submit' value='submit'/><br/>";
		echo "</form>";
		}
	?>
</body>
</html>
<?php ob_end_flush(); ?>